package com.ph.shopping.facade.product.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Service;
import com.ph.shopping.facade.mapper.PhProductImageMapper;
import com.ph.shopping.facade.product.service.IPhProductImageService;
import com.ph.shopping.facade.product.vo.PhProductImageVo;
/**
 * @项目：phshopping-service-product
 * @描述：商品图片
 * @作者： hewl
 * @创建时间：2017年3月6日 上午11:15
 * @Copyright by hewl
 * @version 1.0.0
 */
@Component
@Service(version="1.0.0")
public class PhProductImageServiceImpl implements IPhProductImageService{
	//引用商品图片mapper
	@Autowired
	private PhProductImageMapper phProductImageMapper;
	/**
	 * 查询商品图片
	 * @author hewl
	 * @param phProductImageVo
	 * @return List<PhProductImageVo>
	 */
	public List<PhProductImageVo> getPhProductImageList(PhProductImageVo phProductImageVo) throws Exception{
		return phProductImageMapper.getPhProductImageList(phProductImageVo);
	}
	/**
	 * 单条查询商品图片
	 * @author hewl
	 * @param phProductImageVo
	 * @return PhProductImageVo
	 */
	public PhProductImageVo getPhProductImage(PhProductImageVo phProductImageVo) throws Exception{
		List<PhProductImageVo> list = phProductImageMapper.getPhProductImageList(phProductImageVo);
		if(list.size()>0){
			phProductImageVo = list.get(0);
		}
		return phProductImageVo;
	}
}
